console.log(GetQueryString('userId'))
console.log(userType)
if(userType=='1'){
    $('.perInfo').show()
}else if(userType=='2'){
    $('.SupplierInfo').show()
    $('.supplierGoodsList').show()
}
if(userId!='null'){
    let url= webUrl+'/Customer/getCustomerId/'+userId;
    if(userType==2){
        url = webUrl+'/supplier/getid/'+userId;
    }
    $.ajax({
        type:'get',
        url:url,
        success:function(data){
            if(userType=='1'){
                $('#name').val(data.content.name)
                $('#age').val(data.content.age)
                $('#sex').val(data.content.sex)
                $('.personalBtn').val('修改')
                $('.RuserPhone').val(data.content.phone)
            }else if(userType=='2'){
                $('.RuserPhone').val(data.content.contactNumber)
            }

        }
    })
}
$('.navBox div').click(function(){
    console.log($(this).index())
    $(this).addClass('active').siblings().removeClass('active');
    $('.cont>div').eq($(this).index()).show().siblings().hide();
})
// 完善供应商信息
    $('.postBtn').click(function(){
            console.log(123456)
            console.log($('#companyAbbreviation').val())
            var companyAbbreviation=$('#companyAbbreviation').val(), //公司简称
            registrationName=$('#registrationName').val(), //注册名称
            registeredAddress=$('#registeredAddress').val(), //注册地址
            registeredTelephone=$('#registeredTelephone').val(), //注册电话
            legalRepresentative=$('#legalRepresentative').val(), //法人代表
            accountBankAccount=$('#accountBankAccount').val(), //开户行账号
            otherAccountHolders=$('#otherAccountHolders').val(), //其它开户行账号
            dutyParagraph=$('#dutyParagraph').val(), //税号
            zipCode=$('#zipCode').val(), //邮编
            contacts=$('#contacts').val(), //联系人
            contactNumber=$('#contactNumber').val(), //联系电话
            contactFacsimile=$('#contactFacsimile').val(), //联系传真
            dataSources=$('#dataSources').val(), //数据来源
            postalAddress=$('#postalAddress').val(), //通讯地址
            lastcreate=$('#lastcreate').val(); //Lastcreate
                $.ajax({
                    type:'post',
                    url:webUrl+'/supplier/create',
                    data:{
                        code:'900',
                        lastUpdate:'900',
                        userId:GetQueryString('userId'),
                        registrationName:registrationName,
                        registeredAddress:registeredAddress,
                        registeredTelephone:registeredTelephone,
                        legalRepresentative:legalRepresentative,
                        companyAbbreviation:companyAbbreviation,
                        otherAccountHolders:otherAccountHolders,
                        dutyParagraph:dutyParagraph,
                        accountBankAccount:accountBankAccount,
                        zipCode:zipCode,
                        contacts:contacts,
                        contactNumber:contactNumber,
                        contactFacsimile:contactFacsimile,
                        dataSources:dataSources,
                        postalAddress:postalAddress,
                        lastcreate:lastcreate
                    },
                    success:function(data){
                        console.log(data.content.userTypeId)
                        window.localStorage.setItem('userId',data.content.userTypeId)
                        let searchUrl = encodeURI("index.html"); //使用encodeURI编码
                        location.href = searchUrl;

                    }
                })
    })
//完善个人用户信息
$('.personalBtn').click(function () {
    var name = $('#name').val()
    var age = $('#age').val()
    var sex = $('#sex').val()
    $.ajax({
        url:webUrl + '/Customer/add',
        type:'post',
        data: {
            userId:GetQueryString('userId'),
            name:name,
            age:age,
            sex:sex
        },
        success:function (data) {
            console.log(data.content.id)
            window.localStorage.setItem('userId',data.content.id)
            let searchUrl = encodeURI("index.html"); //使用encodeURI编码
            location.href = searchUrl;
        }
    })
})
// 修改密码
$('#rpw2').on('input propertychange',function () {
    var rpw1 = $('#rpw1').val()
    var rpw2 = $('#rpw2').val()
    if(rpw1!=rpw2){
        $('#rpw2').css('border-color','red')
        return false
    }else{
        $('#rpw2').css('border-color','#ccc')
    }
})
    $('.resetBtn').click(function(){
        var rpw1 = $('#rpw1').val()
        var rpw2 = $('#rpw2').val()
        if(rpw1==rpw2){
            console.log('1')
        }else {
            alert('两次输入不一致')
        }
    })
